package com.project.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.project.bean.CutPageBean;
import com.project.bean.RoomBean;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface IRoomMapper extends BaseMapper<RoomBean> {


    IPage<RoomBean> findByItem(Page page, @Param("address") String address, @Param("state") String state, @Param("info") String info, @Param("type") String type);


    @Insert("INSERT INTO t_room(r_address,r_capacity,r_status,r_type)VALUES(#{address},#{capacity},#{status},#{type})")
    void add(RoomBean room);


    @Select("select * from t_room where r_type=#{gender}")
    @ResultMap("roomMap")
    List<RoomBean> findByGender(String gender);


    @Select("select * from t_room where pk_roomId=#{id}")
    @ResultMap("roomMap")
    RoomBean findByRoomId(Integer id);


    @Delete("delete from t_room where pk_roomId=#{roomId}")
    void del(Integer roomId);
}
